package com.contract.spirit.func.net

import com.contract.commonlib.http.status.BaseBean
import com.contract.spirit.bean.entity.*
import com.contract.spirit.bean.response.*
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

/**
 * @author: witness
 * created: 2021/9/17
 * desc:
 */
interface ApiService {
    @POST("api/common/index")
    suspend fun getMainPageInfo(): BaseBean<MainPageResponse>

    @POST("api/common/bannerList")
    suspend fun getBannerList(): BaseBean<List<BannerInfo>>

    @POST("api/common/appupdate")
    suspend fun checkAppUpdate(): BaseBean<VersionInfoResponse>

    @FormUrlEncoded
    @POST("api/user/checkRegister")
    suspend fun checkRegister(@Field("mobile") mobile: String): BaseBean<RegisterStatusResponse>

    @FormUrlEncoded
    @POST("api/user/login")
    suspend fun login(
        @Field("mobile") mobile: String,
        @Field("smsCode") smsCode: String,
        @Field("inviteCode") inviteCode: String?
    ): BaseBean<String>

    /**
     * @param type 注册登录：register 提现：cash 设置支付密码：setPayPwd
     */
    @FormUrlEncoded
    @POST("api/common/sendSms")
    suspend fun getEmsCode(
        @Field("mobile") mobile: String,
        @Field("type") type: String
    ): BaseBean<String>

    @POST("api/user/getExchangeList")
    suspend fun getExchangeList(): BaseBean<ExchangeResponse>

    @POST("api/user/userInfo")
    suspend fun getUserInfo(): BaseBean<User>

    @POST("/api/user/logout")
    suspend fun exitLogin(): BaseBean<String>

    @FormUrlEncoded
    @POST("api/account/bindAPI")
    suspend fun bindAPI(
        @Field("exchangeType") exchangeType: String,
        @Field("access") access: String,
        @Field("secret") secret: String,
        @Field("phrase") phrase: String?
    ): BaseBean<String>

    @FormUrlEncoded
    @POST("api/order/orderList")
    suspend fun getOrderList(
        @Field("tab") tab: String,
        @Field("currentPage") currentPage: String,
        @Field("exchangeType") exchangeType: String
    ): BaseBean<List<OrderInfo>>

    @FormUrlEncoded
    @POST("api/order/positionList")
    suspend fun getGuarantOrderList(
        @Field("exchangeType") exchangeType: String
    ): BaseBean<List<GuarantOrderInfo>>

    @FormUrlEncoded
    @POST("api/order/gainPay")
    suspend fun gainPay(
        @Field("id") id: String
    ): BaseBean<String>

    @FormUrlEncoded
    @POST("api/user/inviteList")
    suspend fun getInviteUserInfo(
        @Field("currentPage") currentPage: String
    ): BaseBean<InviteRecordResponse>

    @FormUrlEncoded
    @POST("api/account/accoutDetailList")
    suspend fun accoutDetailList(
        @Field("currentPage") currentPage: String
    ): BaseBean<List<IncomeRecordInfo>>

    @FormUrlEncoded
    @POST("api/user/updatePayPassword")
    suspend fun setPassword(
        @Field("password") password: String, @Field("smsCode") smsCode: String
    ): BaseBean<String>

    @POST("api/common/getAppConfig")
    suspend fun getAppConfig(): BaseBean<WithDrawResponse>

    @FormUrlEncoded
    @POST("api/account/cash")
    suspend fun startWithDraw(
        @Field("type") type: String?,
        @Field("cashUrl") cashUrl: String,
        @Field("cashAmount") cashAmount: String,
        @Field("smsCode") smsCode: String,
        @Field("actAmount") actAmount: String,
        @Field("feeAmount") feeAmount: String,
        @Field("payPwd") payPwd: String
    ): BaseBean<String>
}